import axios from '@/utils/request'

/**
 *
 * @returns 获取用户信息
 */
export const getUserChannels = () => {
  return axios({
    url: '/v1_0/user/channels'
  })
}

/**
 *
 * @returns 获取所有频道的信息
 */
export const getAllChannels = () => {
  return axios({
    url: '/v1_0/channels'
  })
}

// 设置用户频道
export const setUserChannels = (channels) => {
  return axios({
    method: 'PATCH',
    url: '/v1_0/user/channels',
    data: {
      channels
    }
  })
}

// 删除频道，提供接口
export function delUserChannels(target) {
  return axios({
    method: 'DELETE',
    // target  需要删除的用户频道id
    url: '/v1_0/user/channels/' + target
  })
}
